#include <stdio.h>

int x[50], y[50];
int cx, cy;
int n, m;

long long chaji (int x1, int y1, int x2, int y2, int x3, int y3)
{
	return (x1-x3) * (long long)(y2-y3) - (x2-x3) * (long long)(y1-y3);
}

bool check ()
{
	for (int i = 0; i < n; i ++)
		if (chaji(x[i], y[i], cx, cy, x[(i + 1) % n], y[(i + 1) % n]) <= 0)
			return false;
	return true;
}

int main ()
{
	while (scanf("%d%d", &n, &m) > 0 && n > 0)
	{
		for (int i = 0; i < n; i ++)
		{
			scanf("%d%d", x + i, y + i);
		}

		int value = m;
		for (int i = 0; i < m; i ++)
		{
			scanf("%d%d", &cx, &cy);
			if (check())
				value ++;
		}
		printf("%d\n", value);
	}

	return 0;
}